package cn.edu.yzu.scholarship.interceptor;

import com.jfinal.aop.Interceptor;
import com.jfinal.core.ActionInvocation;


public class AuthCheckInterceptor implements Interceptor {

	public void intercept(ActionInvocation ai) {
		if(!ai.getActionKey().matches("/user.*")
				&& !ai.getActionKey().matches("/.*.html")
				&& ai.getController().getSessionAttr("user") == null) {//未登陆
			ai.getController().redirect("/login.html");
			return;
		}
		
		ai.invoke();
	}

}
